@extends('common.company_template')

@section('content')
    <div class="boxWidth">
        @include('common.notice_msg')
        <?php
        $id = isset($_GET["id"])?$_GET["id"]:null;
        $item = isset($_GET["item"])?$_GET["item"]:null;
        ?>

        @if($id)
        <div class="row searchLine">
            <div class="col-xs-10 ">
            </div>
            <div class="col-xs-2 searchInput">
                <a href="{{asset('excel/export?id='.$id.'&&item='.$item)}}"><button class="btn btn-default searchBtn">下载</button></a>
            </div>
        </div>
        @endif
        <table class="table table-hover adminTableBg">
            @if($id)
                <thead>
                <tr>
                    @foreach($Name as $n)
                        <th class="col-xs-1">{{$n->name}}</th>
                    @endforeach
                    <th class="col-xs-1">操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($Forms as $Form)
                    <tr>
                        @foreach($Form->form as $F)
                            <th class="col-xs-1 itemTd">{{$F}}</th>
                        @endforeach
                        <?php
                        if($item==0){
                            for ($i = count($Form->form);$i<4;$i++){
                                echo '<th class="col-xs-1 itemTd"></th>';
                            }
                        }
                        ?>
                        <th class="col-xs-1 itemTd">
                            <a href="{{url('company/view',['id' => $Form->id])}}"><span id="addInput">详情</span></a>
                        </th>
                    </tr>
                @endforeach
                </tbody>
            @else
                <thead>
                <tr>
                    <th class="col-xs-2">用户</th>
                    <th class="col-xs-4">页面</th>
                    <th class="col-xs-2">分类</th>
                    <th class="col-xs-2">时间</th>
                    <th class="col-xs-2">操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($Forms as $Form)
                    <tr>
                        <th class="col-xs-2 itemTd">{{$Form->name}}</th>
                        <th class="col-xs-4 itemTd"><a href="{{asset('company').'?id='.$Form->parent.'&&item='.$Form->item}}">{{$Form->title}}</a></th>
                        <th class="col-xs-2 itemTd">{{$Form->typeName}}</th>
                        <th class="col-xs-2 itemTd">{{$Form->created_at}}</th>
                        <th class="col-xs-2 itemTd">
                            <a href="{{url('company/view',['id' => $Form->id])}}"><span id="addInput">详情</span></a>
                        </th>
                    </tr>
                @endforeach
                </tbody>
            @endif
        </table>
        @if(!$id)
            <div class="pull-right">
                <?php
                    $url = [];
                ?>
                {!! $Forms->appends($url)->render() !!}
            </div>
        @endif
    </div>
@stop